package edu.sctu.nieyu.day20150522;

/**
 * Created by user01 on 2015/5/24.
 */
public class TextMore {
    public Teacher[] teacher;
    public TextMore(Teacher[] teacher){
        this.teacher = teacher;

    }

    public void printArray(TextCourse[] use){
        for(int i=0;i<use.length;i++){

        }
    }
    public void sotrNumber(){
        Teacher[] teacherA = new Teacher[teacher.length];
        for(int i =0;i<teacher.length-1;i++){
            for(int j =0;j<teacher.length-1;j++){
                if(teacher[j].number > teacher[j+1].number){
                    teacherA[0] = teacher[j];
                    teacher[j] = teacher[j+1];
                    teacher[j+1] = teacherA[0];
                }
            }

        }
    }
    public void sortStudent(Student[] student){
        System.out.println("学生学号排序：");
        Student[] studentA = new Student[teacher.length];
        for(int i =0;i<student.length-1;i++){
            for(int j =0;j<student.length-1;j++){
                if(student[j].number > student[j+1].number){
                    studentA[0] = student[j];
                    student[j] = student[j+1];
                    student[j+1] = studentA[0];
                    System.out.println("姓名："+student[j].name+"\t学号："+student[j].number);
                }
            }

        }
    }
    public Teacher pritCoded(){
        Teacher returnTeacher = null;
        for(Teacher teacher:this.teacher){
            if(teacher.profession.equals("教授")){
                returnTeacher = teacher;
                System.out.println("职称为教授：\n老师姓名："+teacher.name+"职称："+teacher.profession);
            }
        }
        return returnTeacher;

    }
}
